﻿@{
    ViewBag.Title = "TemplateImageEdit";
    Layout = "~/Views/Shared/_adminLayout.cshtml";
    List<Wx_TemplateImageType> typeList = ViewBag.typeList;
}

@model Wx_TemplateImage

@section Head{
    <style>
    </style>
}
<h2 class="page-header">背景图片</h2>
<div>
    @Html.ActionLink("返回列表", "TemplateImage", null, new { Class = "btn btn-default" })
</div>
<hr />

@using (Html.BeginForm("TemplateImageEdit", "Qrcode", FormMethod.Post, new { id = "form1", Class = "from", onsubmit = "return checkInput();", enctype = "multipart/form-data" }))
{
    <input type="hidden" name="ImgId" value="@Model.ImgId" />
    <input type="hidden" name="ImgSrc" value="@Model.ImgSrc">
    <div class="form-group">
        <label>分类</label>
        <select name="TypeId" id="TypeId" class="form-control" data-rule-required='true' data-msg-required="请选择">
            <option value="">-请选择-</option>
            @foreach (Wx_TemplateImageType p in typeList)
            {
                if (Model.TypeId == p.TypeId)
                {
                    <option value="@p.TypeId" selected="selected">@p.TypeName</option>
                }
                else
                {
                    <option value="@p.TypeId">@p.TypeName</option>
                }

            }
        </select>
    </div>
    <div class="form-group">
        <label>logo</label>
        <input type="file" name="thumbnail" id="thumbnail" />
        @if (!string.IsNullOrEmpty(Model.ImgSrc))
        {
            <img style="max-height:220px;" src="@Url.Content("/images/qrcodeBg/" + Model.ImgSrc)" />
        }
    </div>
    <div class="form-group">
        <label>bgWid</label>
        <input type="text" class="form-control" name="bgWid" value="@Model.bgWid" data-rule-required='true' data-msg-required="bgWid">
    </div>

    <div class="form-group">
        <label>bgHigh</label>
        <input type="text" class="form-control" name="bgHigh" value="@Model.bgHigh" data-rule-required='true' data-msg-required="bgHigh">
    </div>
    <div class="form-group">
        <label>qrcodeX</label>
        <input type="text" class="form-control" name="qrcodeX" value="@Model.qrcodeX" data-rule-required='true' data-msg-required="qrcodeX">
    </div>
    <div class="form-group">
        <label>qrcodeY</label>
        <input type="text" class="form-control" name="qrcodeY" value="@Model.qrcodeY" data-rule-required='true' data-msg-required="qrcodeY">
    </div>
    <div class="form-group">
        <label>qrcodeW</label>
        <input type="text" class="form-control" name="qrcodeW" value="@Model.qrcodeW" data-rule-required='true' data-msg-required="qrcodeW">
    </div>
    <div class="form-group">
        <label>qrcodeAngle</label>
        <input type="text" class="form-control" name="qrcodeAngle" value="@Model.qrcodeAngle" data-rule-required='true' data-msg-required="qrcodeAngle">
    </div>
    <div class="form-group">
        <label>qrcodeColor</label>
        <input type="text" class="form-control" name="qrcodeColor" value="@Model.qrcodeColor" data-rule-required='true' data-msg-required="qrcodeColor">
    </div>

    <div class="form-group">
        <div class="checkbox">
            <label>
                
                @if (Model.qrcodeIsPng)
                {
                    <input type="checkbox" name="qrcodeIsPng" value="true" checked="checked">
                }
                else
                {
                    <input type="checkbox" name="qrcodeIsPng" value="true">
                }
                二维码透明
            </label>
        </div>
    </div>
    <div class="form-group">
        <div class="checkbox">
            <label>
                @if (Model.qrcodeHasBorder)
                {
                    <input type="checkbox" name="qrcodeHasBorder" value="true" checked="checked">
                }
                else
                {
                    <input type="checkbox" name="qrcodeHasBorder" value="true">
                }
                二维码有边框
            </label>
        </div>
    </div>
 
    <div class="form-group">
        <label>Sort</label>
        <input type="text" class="form-control" name="Sort" value="@Model.Sort" data-rule-required='true' data-msg-required="Sort">
    </div>

    <button type="submit" class="btn btn-default">Submit</button>
}

@section Scripts {
    <script src="~/UEditor/ueditor.config.js"></script>
    <script src="~/UEditor/ueditor.all.min.js"></script>
    <script src="~/UEditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript">
        //实例化编辑器
        //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
        var ue = UE.getEditor('editor');
    </script>

    <script src="~/scripts/jquery.validate.min.js"></script>
    <script>
        $(function () {
            validateCN();
        })
        function validateCN() {
            $("form").validate({
                errorClass: "text-danger text-sm",
                errorPlacement: function (error, element) {
                    element.after(error);
                }
            });
        }
        function checkInput() {
            return $("#form1").valid();
        }
    </script>
}


